package com.fangda.netool.util;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;

import java.util.Date;

public class MessageUtil {

    public static String getMessage(Object message, String from, String to) {
        String time = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
        String f = StrUtil.isBlank(from) ? "我" : from;
        String t = StrUtil.isNotBlank(to) ? "" : to;
        String result = time + "   " + f ;
        if(StrUtil.isNotBlank(to)) {
            result += "  发送给 " + to;
        }
        result += "\r\n" + message + "\r\n";
        return result;
    }
}
